package priv.stones.common;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;

/**
 * @Author: Stones
 * @Description:
 * @Date: 2017/9/26 14:30
 */


class OutTime extends TimerTask {

    @Override
    public void run() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
        System.out.println(sdf.format(new Date()));
    }

}

public class Timer1 {


    public static void main(String[] args) {
        Timer timer = new Timer();
        Date date = new Date();
        System.out.println(date.getTime() + 60 * 1000);
        Date date1 = new Date(date.getTime() + 60 * 1000);
        System.out.println(date1);
        Date date2 = new Date(new Date().getTime() + 60 * 1000);
        System.out.println(date2);

        timer.schedule(new OutTime(),date2 , 1000);
    }


}
